//
//  DoubleChromosphere.m
//  PiPiPineapple
//
//  Created by 李晓东 on 17/10/28.
//  Copyright © 2017年 PeanutXu. All rights reserved.
//

#import "DoubleChromosphere_Extension.h"
@interface DoubleChromosphere()
@property (nonatomic, strong) NSString *redA, *redB,*redC,*redD,*redE,*redF;
@property (nonatomic, strong) NSString *blue;
@property (nonatomic, strong) NSString *issueno;
@property (nonatomic, strong) NSString *opendate;

@end

@implementation DoubleChromosphere
+ (instancetype)doubleChromosphere:(NSDictionary *)dict{
    DoubleChromosphere *doubleChromosphere = [[DoubleChromosphere alloc]init];
    NSString *numberStr = dict[@"number"];
    NSArray *array = [numberStr componentsSeparatedByString:@" "];
    [doubleChromosphere setRedA:array[0]];
    [doubleChromosphere setRedB:array[1]];
    [doubleChromosphere setRedC:array[2]];
    [doubleChromosphere setRedD:array[3]];
    [doubleChromosphere setRedE:array[4]];
    [doubleChromosphere setRedF:array[5]];
    [doubleChromosphere setBlue:dict[@"refernumber"]];
    [doubleChromosphere setIssueno:dict[@"issueno"]];
    if (![dict[@"opendate"] containsString:@":"]) {
//        [dict[@"opendate"] appendString:@" 21:18:20"];
        NSString *tempStr = [NSString stringWithFormat:@"%@%@", dict[@"opendate"], @" 21:18:20"];
        [doubleChromosphere setOpendate:tempStr];
    } else {
        [doubleChromosphere setOpendate:dict[@"opendate"]];
    }
    return doubleChromosphere;
}

- (DoubleChromosphere *)initDoubleChromosphere{
    
    return nil;
}

- (NSString *)returnMsg {
    NSString *msg = [NSString stringWithFormat:@"%@--%@", _opendate, _issueno];
    return msg;
}

- (NSString *)returnIssueno{
    return self.issueno;
}

- (NSArray *)returnBall{
    NSArray *array = [NSArray arrayWithObjects:_redA, _redB, _redC, _redD, _redE, _redF, _blue, nil];
    return array;
}

- (NSArray *)returnRedBall{
    NSArray *array = [NSArray arrayWithObjects:_redA, _redB, _redC, _redD, _redE, _redF, nil];
    return array;
}

- (NSString *)returnBlueBall{
    return _blue;
}

- (NSString *)returnACValue{
    return _acValue;
}

- (id)returnSomebody{
    return _somebody;
}

- (void)setSomebody:(id)somebody{
    _somebody = somebody;
}

- (id)returnNextSomeBody{
    return _nextSomeBody;
}

- (void)setNextSomeBody:(id)nextSomeBody{
    _nextSomeBody = nextSomeBody;
}

- (NSString *)returnOpendate{
    return _opendate;
}

- (void)setValues:(NSDictionary *)dict{
    
    NSEnumerator *keys = [dict keyEnumerator];
    
    for (NSObject *object in keys) {
        NSString *value = (NSString *)object;
        if ([value containsString:@"expect"]) {
            [self setValue:[dict valueForKey:value] forKey:@"issueno"];
            continue;
        } else if([value containsString:@"open"]){
            [self setValue:[dict valueForKey:value] forKey:@"opendate"];
            continue;
        }
        [self setValue:[dict valueForKey:value] forKey:value];
    }

}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}
@end
